# -*- coding: UTF-8 -*-
class MyClass:
    i = 12345
    def f(self):
        return "hello world"
'''
x = MyClass()

print("MyClass 类的属性 i 为：", x.i)
print("MyClass 类的方法 f 输出为：", x.f())
'''
  
   
class Complex:
    def __init__(self, realpart, imagpart):
        self.r = realpart
        self.i = imagpart
    
    def prt(self):
        print(self)
        print(self.__class__)
'''
x = Complex(3.0, -4.5)
print(x.r, x.i) 
x.prt()
'''

class people:
    name = ""
    age = 0
    __weight = 0
    def __init__(self, n, a, w):
        self.name = n
        self.age = a
        self.__weight = w
    def speak(self):
        print("%s 说：我%d岁。" %(self.name, self.age))

class student(people):
    grade = ''
    def __init__(self, n, a, w, g):
        people.__init__(self, n, a, w)
        self.grade = g
    def speak(self):
        print("%s 说: 我 %d 岁了，我在读 %d 年级"%(self.name,self.age,self.grade))
 
class speaker():
    topic = ""
    name = ""
    def __init__(self, n, t):
        self.name = n
        self.topic = t      
    def speak(self):
        print("我叫 %s，我是一个演说家，我演讲的主题是 %s" %(self.name,self.topic))

class sample(speaker, student):
    a = ''
    def __init__(self, n, a, w, g, t):
        student.__init__(self, n, a, w, g)
        speaker.__init__(self, n, t)
    def __str__(self):
        return "我同时继承了speaker和student"
    
test = sample("Tim",25,80,4,"Python")
test.speak() 
print(test)